package com.zh.domain.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.zh.handler.JsonMapTypeHandler;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Map;

/**
 * @TableName project_dynamics
 */
@TableName(value = "project_dynamics",autoResultMap = true)
@Data
@ApiModel(value = "ProjectDynamics", description = "项目动态表")
public class ProjectDynamics implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(type = IdType.AUTO)
    @ApiModelProperty("项目动态id")
    private Integer id;
    @ApiModelProperty("项目id")
    private Integer proId;
    @ApiModelProperty("项目动态内容")
    private String content;
    @ApiModelProperty("项目动态参数")
//    @TableField(typeHandler = JsonMapTypeHandler.class)
    @TableField(typeHandler = JacksonTypeHandler.class)
    private Map<String, Object> params;
    @ApiModelProperty("项目动态创建时间")
    private LocalDateTime createAt;
    @ApiModelProperty("项目动态更新时间")
    private LocalDateTime updateAt;
    @ApiModelProperty("项目动态创建人id")
    private Integer createBy;
    @ApiModelProperty("项目动态更新人id")
    private Integer updateBy;
    @ApiModelProperty("项目动态状态")
    private Integer status;
    @ApiModelProperty("项目动态删除标识")
    private Integer deleted;

    public ProjectDynamics() {

    }

    public ProjectDynamics(boolean isInit) {
        if (isInit) {
            this.setStatus(1);
            this.setDeleted(0);
            this.setCreateAt(LocalDateTime.now());
            this.setUpdateAt(LocalDateTime.now());
        }
    }
}